UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5ODHmxvC4DjSIc1A+ZdOMBNzOFwKG99iLtV8Yhab1q4='
WHERE
key_id = '64c4cd55ae94835d9f14f050a50238ad1df004699065219028716fb8112eea11'
AND (
token = '5ODHmxvC4DjSIc1A+ZdOMBNzOFwKG99iLtV8Yhab1q4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)