UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B1WKlVDIesv0ppzMoA0SOSGEsqRBFj1nhcHqQQbPn7U='
WHERE
key_id = 'decb165c2509ba08d57048b0b9304ec1affbb04058a171d3a5a32f8af45abd7b'
AND (
token = 'B1WKlVDIesv0ppzMoA0SOSGEsqRBFj1nhcHqQQbPn7U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)