UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'onrgzceU1toesl7kWrn30FUeHrci3kLoKZg5LEhc4Yg='
WHERE
key_id = 'cbb07742ba36d3ce0e03d8f03daf62d191049e7ef22bbda48f148023c454508b'
AND (
token = 'onrgzceU1toesl7kWrn30FUeHrci3kLoKZg5LEhc4Yg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)