UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UUD6tzyhzHcv6oMBDdSpUQaJoi6L/AzWzMQXFqaBJq8=' 
WHERE 
  key_id = 'c5d94d60f50392559e36e383055ba9a5998d7788000f8d066bce7e81e13ef347' 
  AND (
    token = 'UUD6tzyhzHcv6oMBDdSpUQaJoi6L/AzWzMQXFqaBJq8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043