UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L2Bjv6UAp2rK2f9XxZzWzgTpWzLyfbEj/46hqAJAIKU=' 
WHERE 
  key_id = 'b6bbc78953f9cf7cd86f2f0bd88931dcd8036e5f320e249cc1e01b31d6cc23e3' 
  AND (
    token = 'L2Bjv6UAp2rK2f9XxZzWzgTpWzLyfbEj/46hqAJAIKU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028