UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kTTuj4BucTGjhh+3ZprzBm4Jv0VbWskCk1CzwUvICV0='
WHERE
key_id = '7861024ee53143ac2f431c27cace57869237a9f12649d837a81f5604811667ce'
AND (
token = 'kTTuj4BucTGjhh+3ZprzBm4Jv0VbWskCk1CzwUvICV0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)