UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd1vdf4b6bJxTjTCpq++/rAB+PcMWX+akI7EHZVjtgB4=' 
WHERE 
  key_id = '208b8a05058836d18447963b04d2f3e5f59f65f85956e8382faab1518e21bddc' 
  AND (
    token = 'd1vdf4b6bJxTjTCpq++/rAB+PcMWX+akI7EHZVjtgB4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043