UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W+1JNPc8sNu7Mowye5pqbfPJtyMgD0sp52nf+ezUySY=' 
WHERE 
  key_id = '7d926407929377fa2020c2d7c2a4cfe60f8621e650475c56162b1260c55e98d3' 
  AND (
    token = 'W+1JNPc8sNu7Mowye5pqbfPJtyMgD0sp52nf+ezUySY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034