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