UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S7idJBusMLpXX9hvaYm/4ixwpqb6KJnI9HnbyVRzKpk='
WHERE
key_id = 'aaa601eccdbb8f5499ed15e9e2f776f689bb0ccd9d36ceb63c985ad10aa37239'
AND (
token = 'S7idJBusMLpXX9hvaYm/4ixwpqb6KJnI9HnbyVRzKpk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)