UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2uZDqv99Opoq0VPzOWxjb09PWBhZ0u8MPpZaoB8/hWc='
WHERE
key_id = '525771b70b78e2a78a646934604979fc647e133848e6fd3948a91569671daea9'
AND (
token = '2uZDqv99Opoq0VPzOWxjb09PWBhZ0u8MPpZaoB8/hWc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)