UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gKK6FaMde9mhPjodV8hlt9wg5A+sYPUtHRRrTNSQG7w='
WHERE
key_id = 'f912b2f96e2a1ee333ef066a8f04f44654c3c239475f4f8c9478431e54eba3e7'
AND (
token = 'gKK6FaMde9mhPjodV8hlt9wg5A+sYPUtHRRrTNSQG7w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)