UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z22Ym6Ram2I9Al7byWhJUS2QIoCuNLQZ7FBtYenSle8='
WHERE
key_id = '17924af75406a08f61c8290da68c56eb1d0d0fcb441805ef97dcb209471817f3'
AND (
token = 'Z22Ym6Ram2I9Al7byWhJUS2QIoCuNLQZ7FBtYenSle8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)