UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'da0mE3GXC873imXxb3g0KIppSViamieF/IX9aeLgM4w=' 
WHERE 
  key_id = '4dba16a962cd1dc79f1f3b02c680c1d9955b2eb1d4fca0f87c0b038d632d9259' 
  AND (
    token = 'da0mE3GXC873imXxb3g0KIppSViamieF/IX9aeLgM4w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024