UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DJwyd+1HYxc2m3R2jImPWWioB9xdjIgh8y+ihNSEHLg=' 
WHERE 
  key_id = 'f2d188ca2ec82a11f27f39e864be0697e880c1f01c4f18d0fd739f329aac405a' 
  AND (
    token = 'DJwyd+1HYxc2m3R2jImPWWioB9xdjIgh8y+ihNSEHLg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046