UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ssy2YyecHBwwI6wAhysoKPWswLGnHK2lGJJxnuf+fSk=' 
WHERE 
  key_id = 'c4512a1ed9273740fed2e9ab86f901ac6811a678fc6622ecd520607a287e7df9' 
  AND (
    token = 'ssy2YyecHBwwI6wAhysoKPWswLGnHK2lGJJxnuf+fSk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044