UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kSvd1QWFDEDvNQ3SSaknrWDFkABGvVE9tU9ppZlbkOc=' 
WHERE 
  key_id = '1e145a096e6f7b804a87739b0bc7f30e987c67e59186280d294ea0e1a624603e' 
  AND (
    token = 'kSvd1QWFDEDvNQ3SSaknrWDFkABGvVE9tU9ppZlbkOc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047