UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CH1MwUTDR/uzbuR0SlFTPdx37QL2aJO7NADHJ4NZAnM=' 
WHERE 
  key_id = 'd63fa3e58a6860f2bf6d0ee68ad7e8de6417520222790228185f3d708e47b8b3' 
  AND (
    token = 'CH1MwUTDR/uzbuR0SlFTPdx37QL2aJO7NADHJ4NZAnM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048