UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'anHPerdN3AUI5M+n5ahQLaOGOtvEeff64tsqbQLcQtg=' 
WHERE 
  key_id = '1bbd0c8da5642dd1e9dcb5a54cfd34c84b7283e796f2b962574a2f26cf9844b1' 
  AND (
    token = 'anHPerdN3AUI5M+n5ahQLaOGOtvEeff64tsqbQLcQtg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046