UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nHavVwfJEPaWacZL/+vhv9LoJafVwMNL1HfjIz3PUmE=' 
WHERE 
  key_id = '4b3cf7075cc47861888cd9397b107280df04fed61957d88c39a836b37a21c389' 
  AND (
    token = 'nHavVwfJEPaWacZL/+vhv9LoJafVwMNL1HfjIz3PUmE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039