UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IlDyYyZs8/gB0h02y0ii8pKbLD6S8U2j6zhCShPQD0E='
WHERE
key_id = 'f377bd98110cc5acb6bd1f52e155efe649e7d50955ebe9dbbae31f10e5a9ed00'
AND (
token = 'IlDyYyZs8/gB0h02y0ii8pKbLD6S8U2j6zhCShPQD0E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)