UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pzHdCocTQui4F9QNhC1DRQTz2KUsWK7AE91+baDCjno='
WHERE
key_id = '08360d5b93b6542c2802c193847abf8269afa15511a10cd130aa94a9d8a74ed8'
AND (
token = 'pzHdCocTQui4F9QNhC1DRQTz2KUsWK7AE91+baDCjno='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)