UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zT2W1JdmNwqjvLMUNtUy1SYEIMo+D5h97ts/4tVWpoc=' 
WHERE 
  key_id = 'e39c7c5907842848d593457003b49d0ca664c5c143fa3854f94f29bddeed2dfa' 
  AND (
    token = 'zT2W1JdmNwqjvLMUNtUy1SYEIMo+D5h97ts/4tVWpoc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037