UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dM+vjOs2ZiOQIzj65AACrFgpxxww8e25j39qDla0IWg=' 
WHERE 
  key_id = 'f6048ce02ae35e4aaf766141c3df3fd66916058532708bdd1fd65a3a259e9b2c' 
  AND (
    token = 'dM+vjOs2ZiOQIzj65AACrFgpxxww8e25j39qDla0IWg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041