UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0x333qe8UAgyqb6mk3Hnj4LIb6RV0HYrHdQKKP9tQfM='
WHERE
key_id = '98a8ba54fc56b69315537d561cbf04862f952dc0e204770280d292e357421346'
AND (
token = '0x333qe8UAgyqb6mk3Hnj4LIb6RV0HYrHdQKKP9tQfM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)