UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3+VEK9zrWjsc9ExP3Q4LSgdrWHkm2eYP3fAPXpS2ILc=' 
WHERE 
  key_id = '5f014ee292beda48278bbab3cc7f054ac994213489ee9de2f6b48d71c0d87cda' 
  AND (
    token = '3+VEK9zrWjsc9ExP3Q4LSgdrWHkm2eYP3fAPXpS2ILc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041