UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gEG7vMfGO3zUVhHttnyep9c3vKocE7ZkjYholhplD1c='
WHERE
key_id = 'e4f21a6c477465b2b82b0e82210e6a679d9161ec4e2bbbcf5f2f510b362a5ec6'
AND (
token = 'gEG7vMfGO3zUVhHttnyep9c3vKocE7ZkjYholhplD1c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)