UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xYGV+nNN+Pp6aNnAPpBXrArjsSOSS9VXmlQ3BtSKYxc=' 
WHERE 
  key_id = '14b45f1e5b1f841629c35ebabb34d6838f5687df21055e99add76d99c1ce7c02' 
  AND (
    token = 'xYGV+nNN+Pp6aNnAPpBXrArjsSOSS9VXmlQ3BtSKYxc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024