UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6CuvJrlFAXLMOHEWTlx91oNu1cBoAB3uk6P/rz2R1ns='
WHERE
key_id = 'b0feb1c149bba73eadfa04c8d732a302aaa6eb3b5138655b9301b13ca2de97ef'
AND (
token = '6CuvJrlFAXLMOHEWTlx91oNu1cBoAB3uk6P/rz2R1ns='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)