UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D2U1PLK8AH336MJ44vz91wpJhhMsqXpFENWv6pVvVlU='
WHERE
key_id = '66ec262245ef287469bf864b4e910bcf595eb0dceb7de1875a7c7905382fe334'
AND (
token = 'D2U1PLK8AH336MJ44vz91wpJhhMsqXpFENWv6pVvVlU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)