UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'h9iIBs++p1wcQDfT0DYONeeljdIbQCw2JeI5z9V0ARo='
WHERE
key_id = 'c3eea5e18e9bac601198299352590abcc104aa27631035a0c050a50d7e2e843d'
AND (
token = 'h9iIBs++p1wcQDfT0DYONeeljdIbQCw2JeI5z9V0ARo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)