UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0PN/uz88i3ARE8ozEgCEeD/4Eq9PUrPdN3Z9KELj8q0='
WHERE
key_id = '6386dbf53f89c1d3160f6e208f011955544616e582d16d1c2b24e4b8e6762441'
AND (
token = '0PN/uz88i3ARE8ozEgCEeD/4Eq9PUrPdN3Z9KELj8q0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)