UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MxHyQ3ndlBsrxpZDTlHRu2hwVlB19BfYeEU98ri7+RI='
WHERE
key_id = 'f58338a23a5fec771d650a071f9af3b7f6558382013d9187c359010fc5606c18'
AND (
token = 'MxHyQ3ndlBsrxpZDTlHRu2hwVlB19BfYeEU98ri7+RI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)