UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'thB0euhtZJ9xTcGgBS9GRu+RoFgSCK+jh0SI73N9nAw=' 
WHERE 
  key_id = '46729be14094804271016ce1b19b9ac78b74c586dadce9a575b8d219f0a3281f' 
  AND (
    token = 'thB0euhtZJ9xTcGgBS9GRu+RoFgSCK+jh0SI73N9nAw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00014