UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'de3yNLmaToKJOjNApiNLN7DJbHx+8c9AlPMgPk7KSmo='
WHERE
key_id = 'e5f082b8e3024cfba3c5ce0ba781a202a8e767410d54f0cda2a77b1e72c975ec'
AND (
token = 'de3yNLmaToKJOjNApiNLN7DJbHx+8c9AlPMgPk7KSmo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)