UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iE0odESFBCsg/k8gOFKe38osAhw0VDyCp7DrqGFq6NE=' 
WHERE 
  key_id = 'f6c52e1d9334a778af26c546a1409d2f5a11bbe67f300b3999dd58d562473fff' 
  AND (
    token = 'iE0odESFBCsg/k8gOFKe38osAhw0VDyCp7DrqGFq6NE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023