UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lQTkjfK8PkRvD2dy2e3lrRjLxmwaPgVc1Cq0SNwmX7Q=' 
WHERE 
  key_id = '5d5984cc0f73686f30a0d7a28f667befe09ec77c6e67bd7bb60c9f98c13ea87e' 
  AND (
    token = 'lQTkjfK8PkRvD2dy2e3lrRjLxmwaPgVc1Cq0SNwmX7Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016