UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2XHcqM7feemaAUNZLkBtloSYDH76qfmvEPUYk0Es53c='
WHERE
key_id = 'bc12592fdf96077de09f211f7f2c7ff29745140676b58e1e0616697b7d5949ef'
AND (
token = '2XHcqM7feemaAUNZLkBtloSYDH76qfmvEPUYk0Es53c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)