UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KfwWeEU9G/dO5i4FDauSVs3ydHJSUQkc++M1O6aAIm0='
WHERE
key_id = '4dbae0689a0521f6f73825e917a09ef37de9b72ff3bfb5871fb442f30792109a'
AND (
token = 'KfwWeEU9G/dO5i4FDauSVs3ydHJSUQkc++M1O6aAIm0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)