UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nH4ODt9DFhxi7i/B5kVcpcyyGdWe5wg5PMgJiR2Tk/M=' 
WHERE 
  key_id = 'f4f71811be0cac22df12e648c88d82349b858c5071bc9cc988197efb1f315064' 
  AND (
    token = 'nH4ODt9DFhxi7i/B5kVcpcyyGdWe5wg5PMgJiR2Tk/M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017