UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jrRLemy86plVlTLW3JGDomlyeVXe4nD7+CIPqwOgCKY=' 
WHERE 
  key_id = '35928f46ea9493ddf02354cad5f727256db7cd82343e92edb0e639e2de8cb0c1' 
  AND (
    token = 'jrRLemy86plVlTLW3JGDomlyeVXe4nD7+CIPqwOgCKY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045