UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'efq+8paLPTE8/YzmRStkwhpD7wJntARXiHlVaTzHBhc=' 
WHERE 
  key_id = '6c84e9ad56e5a20b0a91fa1aa7fb650b305211aabe161c638ac781aea302831d' 
  AND (
    token = 'efq+8paLPTE8/YzmRStkwhpD7wJntARXiHlVaTzHBhc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052