UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TP98gz1V0c1nlVPOh2S3Z9jKKfhYWTF1CF51H/uQmG8=' 
WHERE 
  key_id = '3887a8036d2396051498468f8c30fcd3516a47682d7dc6d7166a86f2335b2d67' 
  AND (
    token = 'TP98gz1V0c1nlVPOh2S3Z9jKKfhYWTF1CF51H/uQmG8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037