UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm5R/RijyFIXMEDAjAtt8OQmjE3EUOsCTsFQkpE1IcV8='
WHERE
key_id = '28584a87e4a804369ae3e5cf26b177563d6731302d3630df402ec7729777ae04'
AND (
token = 'm5R/RijyFIXMEDAjAtt8OQmjE3EUOsCTsFQkpE1IcV8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)