UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T+NYQ4HS8fnTmguAy307j6CodKxLu9jeNpJ3JTzstzs='
WHERE
key_id = 'e1bf9599a11d2a3b39e7d7c7b630f8d66d88bb2f24e9f8d9682af1dd110ad1ea'
AND (
token = 'T+NYQ4HS8fnTmguAy307j6CodKxLu9jeNpJ3JTzstzs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)