UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OLoYLdBMQJtj4HY5dtuiIYgpdZsWEx8PctKQFxuXqdE=' 
WHERE 
  key_id = 'e126a1319c7727d57d81169ae2a30c1be854695de08232ba00e4567db8753a07' 
  AND (
    token = 'OLoYLdBMQJtj4HY5dtuiIYgpdZsWEx8PctKQFxuXqdE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028