UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bWC80g1rdxYLbtQ4gUS36cGjY2ZBJm3OkU5V1/4oxGU=' 
WHERE 
  key_id = '3709ebecd99c5fa921f42296c2cd07ce96299bda1a56f16d343b13577bd81616' 
  AND (
    token = 'bWC80g1rdxYLbtQ4gUS36cGjY2ZBJm3OkU5V1/4oxGU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025