UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd7YFOP+1U4nd1aYXRLiZ0SiUBRsdZ6g4UiNU5O0YFL0='
WHERE
key_id = '1e821de6dc2346fd5a943039e47f1dd4ed218bc3a50b19455a7062665a9affec'
AND (
token = 'd7YFOP+1U4nd1aYXRLiZ0SiUBRsdZ6g4UiNU5O0YFL0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)