UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IA3iFkWqHBEoCwrPI4CuG5GmQT5agu4sSTqNNg33OVg='
WHERE
key_id = '3185033dcd9f4daf2057c009738a601cb5780f97830cfbc3d225c442ba51d0e3'
AND (
token = 'IA3iFkWqHBEoCwrPI4CuG5GmQT5agu4sSTqNNg33OVg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)