UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a5ml+1n5X3iGaJS1HMcJSM4+86eqNM0TiYMddAQPNOo='
WHERE
key_id = '9a49ecce582c6b281467684f27b4208a71aa4857fbeff7ec9932a21b533d85bf'
AND (
token = 'a5ml+1n5X3iGaJS1HMcJSM4+86eqNM0TiYMddAQPNOo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)