UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MGcaZUos0OlUkT95cTIH1tRYWxF++oGquznM78sHR+g='
WHERE
key_id = '1aaa817684bf3b39934f9282ea3194fbb83ef8f9b115457d4818f92e02baa358'
AND (
token = 'MGcaZUos0OlUkT95cTIH1tRYWxF++oGquznM78sHR+g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)