UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bnwXSKqJqru5pN6bRuy9BaAPPbqFNbBzSq5bA2XLeqE='
WHERE
key_id = '49131ed6fdb50d3f35e5bf800a7cf08c33afda6350a24085f893c37fa3b43f7c'
AND (
token = 'bnwXSKqJqru5pN6bRuy9BaAPPbqFNbBzSq5bA2XLeqE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)