UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zafygNjZTCNfB2NXms/+d6kzDpSP6OiJG+MT8tMikzc=' 
WHERE 
  key_id = '326e1906b9f491e3b0b260c5eb7fd96d0990208cd8a2e5b4048ebcde9680b257' 
  AND (
    token = 'zafygNjZTCNfB2NXms/+d6kzDpSP6OiJG+MT8tMikzc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029