UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Qg6P/goEza7wAxuygGufMmY5sViisNA4JKYdSfrI+Vs='
WHERE
key_id = 'a21f6153b755d9eaec6196cc8ff206f7a4f454aac13b23d5fdd0b1beb9dab3f3'
AND (
token = 'Qg6P/goEza7wAxuygGufMmY5sViisNA4JKYdSfrI+Vs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)