UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0QxMXuNufJdq0Ju08Bn/cHwTq8VNaObn0ktz91rUCtk='
WHERE
key_id = 'def5e8454e981fb5895067454e78a954d9123c8d9c9ec3535c296325b039c7f7'
AND (
token = '0QxMXuNufJdq0Ju08Bn/cHwTq8VNaObn0ktz91rUCtk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)