UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tOEOcKWkwO3uiyHCwEDXiat9R9LWWdSYu8xtnE4DCXI=' 
WHERE 
  key_id = '58a7e768494335eb545f168415e8c330d4f6d2b0e809e85da4059404a0ee043e' 
  AND (
    token = 'tOEOcKWkwO3uiyHCwEDXiat9R9LWWdSYu8xtnE4DCXI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037