UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mfTgc729UdRLSvgoaXYcrjDHkK2HsiqBhRuRL8FSeP0=' 
WHERE 
  key_id = '29874c9ac006899d498af580fd9712239bb086eb04e9638ee1960c6bd60b9c5a' 
  AND (
    token = 'mfTgc729UdRLSvgoaXYcrjDHkK2HsiqBhRuRL8FSeP0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039