UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M6IdVerkBB2odxUtpKKYRlgZTipDvm+O66Lw+lN1FP0='
WHERE
key_id = 'f5d1526246fb6ab0d39764053e593e341b763b7f166eb01e9327129af925cf3d'
AND (
token = 'M6IdVerkBB2odxUtpKKYRlgZTipDvm+O66Lw+lN1FP0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)